export default{
    addListener() {
      var that = this;
      that.viewer.scene.camera.moveEnd.addEventListener(function (percentage) {
        //监听相机视图,相机停下来之后再加载
        var rectangle = {};
        that.extend = that.viewer.camera.computeViewRectangle(); //可视范围
        rectangle.minx = Cesium.Math.toDegrees(that.extend.west);
        rectangle.miny = Cesium.Math.toDegrees(that.extend.south);
        rectangle.maxx = Cesium.Math.toDegrees(that.extend.east);
        rectangle.maxy = Cesium.Math.toDegrees(that.extend.north);
        // console.log(rectangle);
        // console.log(oldBox);
        // const bs = Cesium.BoundingSphere.fromRectangle3D(extend); //计算extend（可视范围矩形）的边界球
        if (that.cameraHeight < 3000) {
          // console.log("小于2000")
          var length = (rectangle.maxy - rectangle.miny) / 10;
          var width = (rectangle.maxx - rectangle.minx) / 10;
          that.len = length;
          // console.log((rectangle.maxy - rectangle.miny) / 10)
          that.wid = width;
          // 计算每一个小盒子的Bbox
          var screenBbox = []; //可视屏幕内每个小盒子的Bbox的集合
          var p = 0;
          for (var i = 0; i < 10; i++) {
            var scminx = rectangle.minx + i * width;
            var scmaxx = rectangle.minx + (i + 1) * width;
            for (var j = 0; j < 10; j++) {
              var obje = {};
              var scminy = rectangle.maxy - (j + 1) * length;
              var scmaxy = rectangle.maxy - j * length;
              obje.minx = scminx;
              obje.maxx = scmaxx;
              obje.miny = scminy;
              obje.maxy = scmaxy;
              obje.id = p+1;
              screenBbox[p] = obje;
              // console.log(obje)
              p++;
            }
          }
          // console.log(screenBbox)
          var y = (that.sBbox.maxy - that.sBbox.miny) / length; //外接矩形的小盒子纵向应该分为几份
          var x = (that.sBbox.maxx - that.sBbox.minx) / width; //外接矩形的小盒子横向应该分为几份
          // var h = (sBbox.maxy - sBbox.miny) / 505; //每个小盒子的y的长度(固定)
          // var w = (sBbox.maxx - sBbox.minx) / 399; //每个小盒子的x的长度(固定)
          var h = (that.sBbox.maxy - that.sBbox.miny) / y; //每个小盒子的y的长度(不固定)
          var w = (that.sBbox.maxx - that.sBbox.minx) / x; //每个小盒子的x的长度(不固定)
          // console.log(y,x)
          // console.log("纵向分为"+y+"份","横向分为"+x+"份")
          // 循环计算每一个小盒子的BBox：
          var minBbox = []; //外接矩形的每个小盒子的Bbox的集合
          var k = 0;
          for (var i = 0; i < x; i++) {
            var bminx = that.sBbox.minx + i * w;
            var bmaxx = that.sBbox.minx + (i + 1) * w;
            for (var j = 0; j < y; j++) {
              var obj = {};
              var bminy = that.sBbox.maxy - (j + 1) * h;
              var bmaxy = that.sBbox.maxy - j * h;
              obj.minx = bminx;
              obj.miny = bminy;
              obj.maxx = bmaxx;
              obj.maxy = bmaxy;
              obj.id = k+1;
              minBbox[k] = obj;
              // console.log(obj)
              k++;
            }
          }
          var dancex = minBbox[0].minx - screenBbox[0].minx // 外接矩形到可视范围的x方向的距离
          var dancey = minBbox[0].maxy - screenBbox[0].maxy//外接矩形到可视范围的y方向的距离
          var dix = ""
          var diy = ""
          for(var r=0;r<x;r++){//x方向
            if(w * r==Math.abs(dancex)){//屏幕可视范围的点刚好在外接矩形的点上
              // console.log("在横向的第"+r+"个点上")
              dix = r
              // return r//r:在横向的第几个点上
            }
            else if(w*r<Math.abs(dancex)&&w*(r+1)>Math.abs(dancex)){//屏幕的可视范围在外接矩形的小盒子的内部(没在点上)
              // r:在横向的第几个盒子内
              // console.log("在横向的第"+r+"与"+(r+1)+"的盒子内")
              dix = r
              // return r
            }
          }
          for(var s=0;s<y;s++){//y方向
            if(h*s==dancey){//屏幕可视范围的点刚好在外接矩形的点上
              // console.log("在竖向的第"+s+"个点上")
              diy = s
              // return s//s:在竖向的第几个点上
            }
            else if(h*s<dancey&&h*(s+1)>dancey){
              //屏幕的可视范围在外接矩形的小盒子的内部(没在点上)
              // s:在竖向的第几个盒子内
              diy = s
              // console.log("在竖向的第"+s+"与"+(s+1)+"的盒子内")
            }
          }
          // console.log(dix)
          // console.log(diy)
          var remove = {}// 可视范围的左上角所在的外接矩形的小盒子的Bbox：
          remove.minx = minBbox[0].minx + (dix * w)
          remove.maxy = minBbox[0].maxy - (diy * h)
          remove.miny = remove.maxy - h
          remove.maxx = remove.minx + w
          var rtmove = {}//移动后右上角所在的外接矩形的小盒子的Bbox
          rtmove.minx = remove.minx + 9*w
          rtmove.maxy = remove.maxy
          rtmove.miny = rtmove.maxy - h
          rtmove.maxx = rtmove.minx + w
          var lbmove = {}//左下角小所在的外接矩形的小盒子的Bbox
          lbmove.minx = remove.minx
          lbmove.maxy = remove.maxy - 9*h
          lbmove.miny = remove.miny - 9*h
          lbmove.maxx = remove.maxx
          var rbmove = {}//右下角小所在的外接矩形的小盒子的Bbox
          rbmove.minx = rtmove.minx
          rbmove.maxy = rtmove.maxy - 9*h
          rbmove.miny = rtmove.miny - 9*h
          rbmove.maxx = rtmove.maxx
          // console.log(removeminx,removemaxy)
          if(that.unmove.minx !=""){
            // console.log(that.unmove)
            var dx = remove.minx - that.unmove.minx//横向移动的距离
            var dy = remove.maxy - that.unmove.maxy//纵向移动的距离
            if(dx>0){//向右移动
              for(var n=0;n<10;n++){
                  if(dx>=n*w&&dx<w*(n+1)&&Math.abs(dy)<10*h&&Math.abs(dx)<10*w){//横向
                    //加载移动后的右n列，并卸载移动前的左n列
                    console.log("向右移动了"+(n+1)+"列")
                    if(that.oldBoxrt.minx!=""){//右上角盒子
                    //   var rightRemove = []
                    //   var rt = 0
                      // console.log(rtmove)
                      // console.log(that.oldBoxrt)
                      for(var z=1;z<=(n+1);z++){
                        var x1 = that.oldBoxrt.minx + z*w//minx
                        var x2 = x1+w//maxx
                        for(var rtlie=0;rtlie<10;rtlie++){
                          var rit = {}
                          var y1 = rtmove.maxy - rtlie*h//maxy
                          var y2 = y1 - h//miny
                          rit.minx = x1
                          rit.miny = y2
                          rit.maxx = x2
                          rit.maxy = y1
                        //   rightRemove[rt] = rit
                        //   rt++
                          // 单个盒子加载
                          var rtbbox = rit.minx+","+rit.miny+","+rit.maxx+","+rit.maxy
                          var urlrt = "http://112.94.21.83:25015/geoserver/cite/ows?service=WFS&version=1.0.0&request=GetFeature&typeName=cite%3Adayu_building_merge1&outputFormat=application%2Fjson"
                          axios.get(urlrt,{
                            params:{
                              bbox:rtbbox
                            }
                          }).then((res)=>{
                            // console.log(res.data)
                            let dasourit = that.viewer.dataSources._dataSources
                            let sourceright = []
                            for(var g=0;g<dasourit.length;g++){
                              for(var ge=0;ge<dasourit[g].entities.values.length;ge++){
                                sourceright.push(dasourit[g].entities.values[ge]._id)
                              }
                            }
                            // var dataValue = res.data
                            var datasourceRt = Cesium.GeoJsonDataSource.load(res.data)
                            datasourceRt.then(function (source) {
                              let validRt = source.entities.values
                              if(that.getValueRight.length==0){
                                that.viewer.dataSources.add(source);
                              }
                              else if(that.getValueRight.length>0){//过滤重复数据，避免重复加载
                                for(let t=0;t<source.entities.values.length;t++){
                                  for(let j=0;j<sourceright.length;j++){
                                    if(source.entities.values[t]._id == sourceright[j]){
                                      source.entities.values.splice(t,1)
                                    }
                                  }
                                }
                                that.viewer.dataSources.add(source)
                              }
                              for(let d=0;d<validRt.length;d++){
                                that.getValueRight.push(validRt[d]._id)//将id保存起来
                                // console.log(that.getValueRight)
                              }
                            });
                          })
                        }
                      }
                      // console.log(rightRemove)
                      // //加载移动后的每个小盒子构成的矩形的bbox去加载
                      // var ttop={}
                      // ttop.minx = rightRemove[0].minx
                      // ttop.miny = rightRemove[rightRemove.length - 1].miny
                      // ttop.maxx = rightRemove[rightRemove.length - 1].maxx
                      // ttop.maxy = rightRemove[0].maxy
                      // var rtbbox = ttop.minx+","+ttop.miny+","+ttop.maxx+","+ttop.maxy
                      // // console.log(rtbbox)
                      // var urlrt = "http://112.94.21.83:25015/geoserver/cite/ows?service=WFS&version=1.0.0&request=GetFeature&typeName=cite%3Adayu_building_merge1&outputFormat=application%2Fjson"
                      // axios.get(urlrt,{
                      //   params:{
                      //     bbox:rtbbox
                      //   }
                      // }).then((res)=>{
                      //   var dataValue = res.data
                      //   // console.log(res.data)
                      //   // that.getValue.push(dataValue.features)
                      //   var datasourceRt = Cesium.GeoJsonDataSource.load(dataValue)
                      //   datasourceRt.then(function (source) {
                      //     source.entities.values;
                      //     that.viewer.dataSources.add(source);
                      //     // that.viewer.dataSources.remove(source.entities)
                      //     // console.log(that.viewer.dataSources)
                      //   });
                      // })
                    }
                    // 卸载左边的n列
                    // var leftXz = []
                    // var xzlt = 0
                    for(var e=0;e<n;e++){
                      var xznx = that.oldBoxlt.minx + (e-2)*w//minx
                      var xzxx = xznx + w
                      for(var li=0;li<10;li++){
                        var ft = {}
                        var zxxy = that.oldBoxlt.maxy - li*h//maxy
                        var zxny = zxxy - h//miny
                        ft.minx = xznx
                        ft.miny = zxny
                        ft.maxx = xzxx
                        ft.maxy = zxxy
                        // leftXz[xzlt] = ft
                        // xzlt++
                        var xzbbox1 = ft.minx+","+ft.miny+","+ft.maxx+","+ft.maxy
                        var xzurlrt1 = "http://112.94.21.83:25015/geoserver/cite/ows?service=WFS&version=1.0.0&request=GetFeature&typeName=cite%3Adayu_building_merge1&outputFormat=application%2Fjson"
                        axios.get(xzurlrt1,{
                          params:{
                            bbox:xzbbox1
                          }
                        }).then((res)=>{
                          let datasourcexzLet = Cesium.GeoJsonDataSource.load(res.data)
                          datasourcexzLet.then(function(source){
                            // that.viewer.dataSources.add(source);
                            // console.log(source)
                            let xzsource = source.entities.values
                            let dasouritxz = that.viewer.dataSources._dataSources
                            for(var g=0;g<dasouritxz.length;g++){
                              for(var so=0;so<xzsource.length;so++){
                                for(var va=0;va<dasouritxz[g].entities.values.length;va++){
                                  if(xzsource[so]._id==dasouritxz[g].entities.values[va]._id){//只要其中的一条相等就卸载整个盒子中的数据
                                    that.viewer.dataSources.remove(dasouritxz[g])
                                  }
                                }
                              }
                            }
                          })
                        })
                      }
                    }
                  }
              }
            }
            else if(dx<0){//向左移动
            //   var leftRemove = []//左边加载的
            //   var lt=0
              for(var n2=0;n2<10;n2++){
                  if(Math.abs(dx)>=n2*w&&Math.abs(dx)<w*(n2+1)&&Math.abs(dy)<10*h&&Math.abs(dx)<10*w){//横向
                    //加载移动后的左边n列，并卸载移动前的右边的n列
                    console.log("向左移动了"+(n2+1)+"列")
                    if(that.oldBoxlt.minx!=""){
                      for(var z=1;z<=(n2+1);z++){
                        // 左边需要加载的x方向Bbox
                        var x1 = that.oldBoxlt.minx - z*w//minx
                        var x2 = that.oldBoxlt.maxx - z*w//maxx
                        // 右边需要卸载的x方向的Bbox
                        var rnx = rtmove.minx + z*w//移动后的右边的minx
                        var rxx = rnx + w//移动后的右边的maxx
                        for(var ltlie=0;ltlie<10;ltlie++){
                          var left = {}//左边需要加载的
                          var y1 = remove.maxy - ltlie*h//maxy
                          var y2 = y1 - h//miny
                          left.minx = x1
                          left.miny = y2
                          left.maxx = x2
                          left.maxy = y1
                        //   leftRemove[lt] = left
                          // 单个加载
                          var rtbbox = left.minx+","+left.miny+","+left.maxx+","+left.maxy
                          var urlrt = "http://112.94.21.83:25015/geoserver/cite/ows?service=WFS&version=1.0.0&request=GetFeature&typeName=cite%3Adayu_building_merge1&outputFormat=application%2Fjson"
                          axios.get(urlrt,{
                            params:{
                              bbox:rtbbox
                            }
                          }).then((res)=>{
                            let dasoulet = that.viewer.dataSources._dataSources
                            let sourceleft = []
                            for(var g=0;g<dasoulet.length;g++){
                              for(var ge=0;ge<dasoulet[g].entities.values.length;ge++){
                                sourceleft.push(dasoulet[g].entities.values[ge]._id)
                              }
                            }
                            var dataValue = res.data
                            // console.log(dataValue)
                            var datasourceRt = Cesium.GeoJsonDataSource.load(dataValue)
                            datasourceRt.then(function (source){
                              let validLt = source.entities.values
                              if(that.getValueLeft.length==0){
                                that.viewer.dataSources.add(source);
                              }
                              else{//过滤
                                for(let t=0;t<source.entities.values.length;t++){
                                  for(let j=0;j<sourceleft.length;j++){
                                    if(source.entities.values[t]._id == sourceleft[j]){
                                      source.entities.values.splice(t,1)
                                    }
                                  }
                                }
                                that.viewer.dataSources.add(source)
                              }
                              for(let d=0;d<validLt.length;d++){
                                that.getValueLeft.push(validLt[d]._id)//将id保存起来
                                // console.log(that.getValueRight)
                              }
                            });
                          })
                        //   lt++
                        }
                      }
                      // // console.log(that.viewer.dataSources._dataSources)
                      // // 整体加载
                      // var lft={}
                      // lft.minx = leftRemove[leftRemove.length - 1].minx
                      // lft.miny = leftRemove[leftRemove.length - 1].miny
                      // lft.maxx = leftRemove[0].maxx
                      // lft.maxy = leftRemove[0].maxy
                      // // console.log(lft.minx)
                      // var rtbbox = lft.minx+","+lft.miny+","+lft.maxx+","+lft.maxy
                      // var urlrt = "http://112.94.21.83:25015/geoserver/cite/ows?service=WFS&version=1.0.0&request=GetFeature&typeName=cite%3Adayu_building_merge1&outputFormat=application%2Fjson"
                      // axios.get(urlrt,{
                      //   params:{
                      //     bbox:rtbbox
                      //   }
                      // }).then((res)=>{
                      //   var dataValue = res.data
                      //   // console.log(dataValue)
                      //   var datasourceRt = Cesium.GeoJsonDataSource.load(dataValue)
                      //   datasourceRt.then(function (source){
                      //     source.entities.values;
                      //     that.viewer.dataSources.add(source);
                      //     // console.log(source)
                      //   });
                      // })
                    }
                    // 卸载右边的n列
                    // console.log("卸载右边的n列")
                    for(var a=0;a<n2;a++){
                      // console.log("执行到这了")
                      let xzrnx = that.oldBoxrt.minx - (a-2)*w//minx
                      let xzrxx = xzrnx + w//maxx
                      for(var u=0;u<=10;u++){
                        let rtz = {}
                        let xzrxy = that.oldBoxrt.maxy - u*h//maxy
                        let xzrny = xzrxy - h//miny
                        rtz.minx = xzrnx
                        rtz.miny = xzrny
                        rtz.maxx = xzrxx
                        rtz.maxy = xzrxy
                        var zxrbbox = rtz.minx+","+rtz.miny+","+rtz.maxx+","+rtz.maxy
                        var xzrurlrt = "http://112.94.21.83:25015/geoserver/cite/ows?service=WFS&version=1.0.0&request=GetFeature&typeName=cite%3Adayu_building_merge1&outputFormat=application%2Fjson"
                        axios.get(xzrurlrt,{
                          params:{
                            bbox:zxrbbox
                          }
                        }).then((res)=>{
                          // console.log(res.data)
                          let datasourcexzLet = Cesium.GeoJsonDataSource.load(res.data)
                          datasourcexzLet.then(function(source){
                            // console.log(source)
                            let xzsource = source.entities.values
                            let dasouritxz = that.viewer.dataSources._dataSources
                            for(var g=0;g<dasouritxz.length;g++){
                              for(var so=0;so<xzsource.length;so++){
                                for(var va=0;va<dasouritxz[g].entities.values.length;va++){
                                  if(xzsource[so]._id==dasouritxz[g].entities.values[va]._id){
                                    that.viewer.dataSources.remove(dasouritxz[g])
                                  }
                                }
                              }
                            }
                          })
                        })
                      }
                    }
                  }
              }
            }
            if(dy>0){//向上移动
            //   var topRemove = []
            //   var to=0
              for(var m=0;m<10;m++){
                  if(dy>=m*h&&dy<h*(m+1)&&Math.abs(dy)<10*h&&Math.abs(dx)<10*w){
                    // 加载移动后上边的前m行，卸载移动前的后边的m行
                    console.log("向上移动了"+(m+1)+"行")
                    if(that.oldBoxlt.minx!=""){
                      for(var v=1;v<=(m+1);v++){
                        var ny = that.oldBoxlt.miny + v*h//miny
                        var xy = ny+h//maxy
                        for(var tph=0;tph<10;tph++){
                          var top = {}
                          var nx = remove.minx + tph*w//minx
                          var xx = nx + w //maxx
                          top.minx = nx
                          top.miny = ny
                          top.maxx = xx
                          top.maxy = xy
                        //   topRemove[to] = top
                        //   to++
                          // 单个盒子加载
                          var topbbox = top.minx+","+top.miny+","+top.maxx+","+top.maxy
                          var urltop = "http://112.94.21.83:25015/geoserver/cite/ows?service=WFS&version=1.0.0&request=GetFeature&typeName=cite%3Adayu_building_merge1&outputFormat=application%2Fjson"
                          axios.get(urltop,{
                            params:{
                              bbox:topbbox
                            }
                          }).then((res)=>{
                            let dasourtop = that.viewer.dataSources._dataSources
                            let sourceTop = []
                            for(var g=0;g<dasourtop.length;g++){
                              for(var ge=0;ge<dasourtop[g].entities.values.length;ge++){
                                sourceTop.push(dasourtop[g].entities.values[ge]._id)
                              }
                            }
                            // console.log(sourceTop)
                            var datasourceRt1 = Cesium.GeoJsonDataSource.load(res.data)
                            datasourceRt1.then(function (source) {
                              let validTp = source.entities.values;
                              if(that.getValueTop.length==0){
                                that.viewer.dataSources.add(source);
                              }
                              else{
                                for(let t=0;t<source.entities.values.length;t++){
                                  for(let j=0;j<sourceTop.length;j++){
                                    if(source.entities.values[t]._id == sourceTop[j]){
                                      source.entities.values.splice(t,1)
                                    }
                                  }
                                }
                                that.viewer.dataSources.add(source)
                              }
                              for(let d=0;d<validTp.length;d++){
                                that.getValueTop.push(validTp[d]._id)//将id保存起来
                                // console.log(that.getValueRight)
                              }
                            });
                          })
                        }
                      }
                      // //整体加载
                      // var tp={}
                      // // console.log(topRemove)
                      // tp.minx = topRemove[0].minx
                      // tp.miny = topRemove[0].miny
                      // tp.maxx = topRemove[topRemove.length - 1].maxx
                      // tp.maxy = topRemove[topRemove.length - 1].maxy
                      // // console.log(tp)
                      // var topbbox = tp.minx+","+tp.miny+","+tp.maxx+","+tp.maxy
                      // var urltop = "http://112.94.21.83:25015/geoserver/cite/ows?service=WFS&version=1.0.0&request=GetFeature&typeName=cite%3Adayu_building_merge1&outputFormat=application%2Fjson"
                      // axios.get(urltop,{
                      //   params:{
                      //     bbox:topbbox
                      //   }
                      // }).then((res)=>{
                      //   var dataValue1 = res.data
                      //   // console.log(dataValue1)
                      //   var datasourceRt1 = Cesium.GeoJsonDataSource.load(dataValue1)
                      //   datasourceRt1.then(function (source) {
                      //     source.entities.values;
                      //     that.viewer.dataSources.add(source);
                      //   });
                      // })
                    }
                    // 卸载移动后下面的m行
                    // console.log("卸载下边"+m+"行")
                    for(var b=0;b<m;b++){
                      var xzny = that.oldBoxlb.miny + (b - 2)*h//miny
                      var xzxy = xzny + h//maxy
                      for(var zb=0;zb<10;zb++){
                        let boxz = {}
                        var xzbnx = that.oldBoxlb.minx + zb*w//minx
                        var xzbxx = xzbnx + w //maxx
                        boxz.minx = xzbnx
                        boxz.miny = xzny
                        boxz.maxx = xzbxx
                        boxz.maxy = xzxy
                        var zxbobbox = boxz.minx+","+boxz.miny+","+boxz.maxx+","+boxz.maxy
                        var xzbourlrt = "http://112.94.21.83:25015/geoserver/cite/ows?service=WFS&version=1.0.0&request=GetFeature&typeName=cite%3Adayu_building_merge1&outputFormat=application%2Fjson"
                        axios.get(xzbourlrt,{
                          params:{
                            bbox:zxbobbox
                          }
                        }).then((res)=>{
                          // console.log(res.data)
                          let datasourcexzbLet = Cesium.GeoJsonDataSource.load(res.data)
                          datasourcexzbLet.then(function(source){
                            // console.log(source)
                            let xzbsource = source.entities.values
                            let dasouritxzb = that.viewer.dataSources._dataSources
                            for(var gb=0;gb<dasouritxzb.length;gb++){
                              // console.log(xzbsource.length)
                              for(var sob=0;sob<xzbsource.length;sob++){
                                for(var vab=0;vab<dasouritxzb[gb].entities.values.length;vab++){
                                  if(xzbsource[sob]._id==dasouritxzb[gb].entities.values[vab]._id){
                                    that.viewer.dataSources.remove(dasouritxzb[gb])
                                    // console.log("卸载了")
                                  }
                                }
                              }
                            }
                          })
                        })
                      }
                    }
                  }
              }
            }
            else if(dy<0){//向下移动
            //   var bottomRemove = [] 
            //   var bt=0
              for(var m2=0;m2<10;m2++){
                  if(Math.abs(dy)>=m2*h&&Math.abs(dy)<h*(m2+1)&&Math.abs(dy)<10*h&&Math.abs(dx)<10*w){
                    // 加载移动后的下边的m行，卸载移动前的上边的m行
                    console.log("向下移动了"+(m2+1)+"行")
                    if(that.oldBoxlb.minx!=""){
                      for(var v=1;v<=(m2+1);v++){
                        var ny = that.oldBoxlb.miny - v*h//miny
                        var xy = that.oldBoxlb.maxy -v*h//maxy
                        for(var bth=0;bth<10;bth++){
                          var bottom = {}
                          // var nx = that.oldBoxlb.minx + bth*w//minx
                          var nx = lbmove.minx + bth*w//minx
                          var xx = nx + w//maxx
                          bottom.minx = nx
                          bottom.miny = ny
                          bottom.maxx = xx
                          bottom.maxy = xy
                        //   bottomRemove[bt] = bottom
                          // console.log(bottomRemove[bt])
                        //   bt++
                          // 单个盒子加载
                          var botbbox = bottom.minx+","+bottom.miny+","+bottom.maxx+","+bottom.maxy
                          // console.log(botbbox)
                          var urlbot = "http://112.94.21.83:25015/geoserver/cite/ows?service=WFS&version=1.0.0&request=GetFeature&typeName=cite%3Adayu_building_merge1&outputFormat=application%2Fjson"
                          axios.get(urlbot,{
                            params:{
                              bbox:botbbox
                            }
                          }).then((res)=>{
                            let dasoubtm = that.viewer.dataSources._dataSources
                            let sourcebtm = []
                            for(var g=0;g<dasoubtm.length;g++){
                              for(var ge=0;ge<dasoubtm[g].entities.values.length;ge++){
                                sourcebtm.push(dasoubtm[g].entities.values[ge]._id)
                              }
                            }
                            var dataValue1 = res.data
                            var datasourceRt1 = Cesium.GeoJsonDataSource.load(dataValue1)
                            datasourceRt1.then(function (source) {
                              // console.log(source)
                              let validBtm = source.entities.values;
                              if(that.getValueBottom.length==0){
                                that.viewer.dataSources.add(source);
                              }
                              else{//过滤掉重复的
                                for(let t=0;t<source.entities.values.length;t++){
                                  for(let j=0;j<sourcebtm.length;j++){
                                    if(source.entities.values[t]._id == sourcebtm[j]){
                                      source.entities.values.splice(t,1)
                                    }
                                  }
                                }
                                that.viewer.dataSources.add(source)
                              }
                              for(let d=0;d<validBtm.length;d++){
                                that.getValueBottom.push(validBtm[d]._id)//将id保存起来
                                // console.log(that.getValueRight)
                              }
                            });
                          })
                        }
                      }
                      // console.log(that.viewer.dataSources)
                      // // 整体加载
                      // var botm={}
                      // botm.minx = bottomRemove[0].minx
                      // botm.miny = bottomRemove[bottomRemove.length - 1].miny
                      // botm.maxx = bottomRemove[bottomRemove.length - 1].maxx
                      // botm.maxy = bottomRemove[0].maxy
                      // // console.log(botm)
                      // var botbbox = botm.minx+","+botm.miny+","+botm.maxx+","+botm.maxy
                      // // console.log(botbbox)
                      // var urlbot = "http://112.94.21.83:25015/geoserver/cite/ows?service=WFS&version=1.0.0&request=GetFeature&typeName=cite%3Adayu_building_merge1&outputFormat=application%2Fjson"
                      // axios.get(urlbot,{
                      //   params:{
                      //     bbox:botbbox
                      //   }
                      // }).then((res)=>{
                      //   var dataValue1 = res.data
                      //   var datasourceRt1 = Cesium.GeoJsonDataSource.load(dataValue1)
                      //   datasourceRt1.then(function (source) {
                      //     source.entities.values;
                      //     that.viewer.dataSources.add(source);
                      //   });
                      // })
                    }
                    // 卸载移动后上边的m2行
                    for(var tp=0;tp<m2;tp++){
                      var xztny = that.oldBoxlt.miny - (tp - 2)*h//miny
                      var xztxy = xztny + h//maxy
                      for(var to=0;to<10;to++){
                        let boxzt = {}
                        var xztbnx = that.oldBoxlt.minx + to*w//minx
                        var xztbxx = xztbnx + w //maxx
                        boxzt.minx = xztbnx
                        boxzt.miny = xztny
                        boxzt.maxx = xztbxx
                        boxzt.maxy = xztxy
                        var zxbobbox = boxzt.minx+","+boxzt.miny+","+boxzt.maxx+","+boxzt.maxy
                        var xzbourlrt = "http://112.94.21.83:25015/geoserver/cite/ows?service=WFS&version=1.0.0&request=GetFeature&typeName=cite%3Adayu_building_merge1&outputFormat=application%2Fjson"
                        axios.get(xzbourlrt,{
                          params:{
                            bbox:zxbobbox
                          }
                        }).then((res)=>{
                          // console.log(res.data)
                          let datasourcexzbLet = Cesium.GeoJsonDataSource.load(res.data)
                          datasourcexzbLet.then(function(source){
                            // console.log(source)
                            let xzbsource = source.entities.values
                            let dasouritxzb = that.viewer.dataSources._dataSources
                            for(var gb=0;gb<dasouritxzb.length;gb++){
                              for(var sob=0;sob<xzbsource.length;sob++){
                                for(var vab=0;vab<dasouritxzb[gb].entities.values.length;vab++){
                                  if(xzbsource[sob]._id==dasouritxzb[gb].entities.values[vab]._id){
                                    that.viewer.dataSources.remove(dasouritxzb[gb])
                                    // console.log("卸载了")
                                  }
                                }
                              }
                            }
                          })
                        })
                      }
                    }
                  }
              }
            }
            if(Math.abs(dy)>=10*h||Math.abs(dx)>=10*w){//移动的距离超出当前可视范围
              // 卸载上一个可视范围内的实体
              // 加载当前可视范围内的实体
              console.log("移动距离超出上一个可视范围")
              // console.log(rectangle)
              // 全部卸载
              that.viewer.dataSources.removeAll()
              // 将当前可视范围分为十份
              let beyondx = (rectangle.maxx - rectangle.minx) / 10
              let beyondy = (rectangle.maxy - rectangle.miny) / 10
              for(var l=0;l<10;l++){
                var beyondminx = rectangle.minx + l * beyondx
                var beyondmaxx = beyondminx + beyondx
                for(var n=0;n<10;n++){
                  var beobjec = {}
                  var beyondminy = rectangle.maxy - (n + 1) * beyondy;
                  var beyondmaxy = beyondminy + beyondy
                  beobjec.minx = beyondminx;
                  beobjec.miny = beyondminy;
                  beobjec.maxx = beyondmaxx;
                  beobjec.maxy = beyondmaxy;
                  var bboxall = beyondminx+","+beyondminy+","+beyondmaxx+","+beyondmaxy
                  var urlall = "http://112.94.21.83:25015/geoserver/cite/ows?service=WFS&version=1.0.0&request=GetFeature&typeName=cite%3Adayu_building_merge1&outputFormat=application%2Fjson"
                  axios.get(urlall,{
                    params:{
                      bbox:bboxall
                    }
                  }).then((res)=>{
                    var dataValue = res.data
                    // console.log(dataValue)
                    var datasourceRt = Cesium.GeoJsonDataSource.load(dataValue)
                    datasourceRt.then(function (source){
                      let beyondId = source.entities.values//接收实体values
                      if(that.beyondValue.length==0){//that.beyondValue长度为0时直接加载实体
                        that.viewer.dataSources.add(source);
                      }
                      else{//that.beyondValue长度大于0时去除id重复的内容后再加载
                        for(let m=0;m<source.entities.values.length;m++){
                          for(let v=0;v<that.beyondValue.length;v++){
                            if(source.entities.values[m]._id == that.beyondValue[v]){
                              source.entities.values.splice(m,1)//删除当前的id与之前有重复的数据
                            }
                          }
                        }
                        that.viewer.dataSources.add(source)
                      }
                      for(let c=0;c<beyondId.length;c++){
                        that.beyondValue.push(beyondId[c]._id)//将id保存起来
                        // console.log(that.getValue)
                      }
                    });
                  })
                }
              }
            }
            // console.log(remove)
            // console.log(minBbox)
            // console.log(that.viewer.dataSources)
            that.oldBoxrt = rtmove
            that.oldBoxlt = remove
            that.oldBoxlb = lbmove
            that.oldBoxrb = rbmove
          }
          that.unmove = remove
          // 移动之后将装id的数组清空，避免下次移动到此处时出现重复被删除
          that.getValueRight = []//右
          that.getValueLeft = []//左
          that. getValueTop = []//上
          that. getValueBottom = []//下
          that.beyondValue = []//完全出可视范围
          // console.log(that.viewer.dataSources._dataSources)
          // console.log(that.viewer.dataSources)
        }
      });
    },
}